import request  from "../utils/request"
import qs from "querystring"

export const findProdutByPage = (query)=>{
    return request.get("/product",{
        params:query,
        paramsSerializer:(params)=>{
            return qs.stringify(params);
        }
    })
}
export const findProdutByCondition = (query)=>{
    return request.get("/product/by/condition",{
        params:query,
        paramsSerializer:(params)=>{
            return qs.stringify(params);
        }
    })
}

export const deleteProductById = (productId) => {
    return request.delete("/product/"+productId);
} 

export const deleteProductByBatch = (productIds) => {
    return request.delete("/product/batchDelete?productIds="+productIds);
}

export const saveOrUpdateProduct = (param) => {
    return request.post("/product",param);
}